import { request } from '@/utils/hsj/service/index'
import { parseStrEmpty } from '@/utils/ruoyi'

// 查询客户列表
export function listInfo(query) {
  return request({
    url: '/system/customer/list',
    method: 'get',
    params: query,
  })
}

// 查询客户详细
export function getInfo(customerId) {
  return request({
    url: '/system/customer/' + parseStrEmpty(customerId),
    method: 'get',
  })
}

// 新增客户
export function addInfo(data) {
  return request({
    url: '/system/customer',
    method: 'post',
    data: data,
  })
}

// 修改客户
export function updateInfo(data) {
  return request({
    url: '/system/customer',
    method: 'put',
    data: data,
  })
}

// 删除客户
export function delInfo(customerId) {
  return request({
    url: '/system/customer/' + customerId,
    method: 'delete',
  })
}

// 客户状态修改
export function changeInfoStatus(customerId, status) {
  const data = {
    customerId,
    status,
  }
  return request({
    url: '/system/customer/changeStatus',
    method: 'put',
    data: data,
  })
}

